import random as r
surnName = [
    '张', '金', '李', '王', '赵', '钱', '孙', '吴', '郑', '冯', '陈', '魏', '沈', '程', '许',
    '徐', '韩', '杨', '方'
]
secondName = [
    '玉', '明', '龙', '芳', '军', '玲', '成', '达', '文', '景', '欣', '可', '启', '小', '涵',
    '兴', '诺', '涛', '仕', '光'
]
thirdName = [
    '', '立', '玲', '', '国', '', '明', '宇', '辉', '达', '仪', '', '凡', '晨', '', '高',
    '佳', '浩', '志', '瑞', '锐'
]
sexCode = ['1', '0']  #male=1, female=0
lessonCode = range(200)

with open("teacherInfo.txt", "w") as f:
    # metadeta
    # content: teacher number
    f.write('###')
    totalTeacher = 2000
    f.write(str(totalTeacher))
    f.write('###\n')

    # teacher data
    for i in range(totalTeacher):
        t_id = ''
        for j in range(4 - len(str(i))):
            t_id += '0'
        t_id += str(i)
        name = r.choice(surnName) + r.choice(secondName) + r.choice(thirdName)
        sex = r.choice(sexCode)
        password = "123456"
        lesson = ''
        for j in range(r.randint(0, 4)):
            thisLesson = str(r.choice(lessonCode))
            for k in range(3 - len(thisLesson)):
                lesson += '0'
            lesson += thisLesson
        if lesson == '':
            lesson = '#'
            # each 3 character indicates a class
        f.write(t_id + ' ' + name + ' ' + sex + ' '+password+' '+lesson+'\n')
        #data in each line: id, name, sex, password, lessons
